/**
 * @author lulongwen
 * Date: 2023-08-30 22:38
 * Description: Diamond 菱形，钻石
 */

export function Diamond(props: any) {
  const { width } = props;

  const cx = width / 2;

  // "M0,50 L50,0 L100,50 L50,100 z"
  const path = [
    ['M0', cx], // M0,50
    [`L${cx}`, 0], // L50,0
    [`L${width}`, cx], // L100,50
    [`L${cx}`, width], // L50,100
    ['z'],
  ]
    .map(item => item.join(','))
    .join(' ');

  return (
    <svg
      xmlns="http://www.w3.org/2000/svg"
      width={width}
      height={width}
      className='block'
    >
      <path
        d={path}
        // d="M0,50 L50,0 L100,50 L50,100 z"
        // 填充颜色
        fill="#ff6700"
        strokeWidth="0"
        stroke="#fff"
      />
    </svg>
  );
}
